<template>
    <view class="search_contain">
        <nut-searchbar v-model="keyWord" placeholder="请输入关键字或承运单号查询" @search="emit('search', keyWord)">
            <template v-slot:leftin>
                <Search2 />
            </template>
            <template v-slot:rightout>
                <Scan />
            </template>
        </nut-searchbar>
    </view>
</template>
    
<script setup lang='ts'>
import { ref, watch } from 'vue';
import Scan from '../Scan/index.vue'
import useOrderStore from '@/store/order'
import { Search2 } from '@nutui/icons-vue-taro';

const orderStore = useOrderStore()

const keyWord = ref('')
const emit = defineEmits(['search'])

console.log(JSON.parse(JSON.stringify(orderStore)),'orderStore')

watch(() => orderStore.keywords, (newVal) => {
    keyWord.value = newVal
}, { deep: true, immediate: true })

</script>
    
<style>
.search_contain {
    height: 100rpx;
}
</style>